# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: googol <googol@posteo.de>
# Contributor: Oliver Mangold <o.mangold at gmail dot com>

pkgname=python-alembic
pkgver=1.9.4
pkgrel=3
pkgdesc='Lightweight database migration tool for usage with SQLAlchemy'
url='https://github.com/sqlalchemy/alembic'
arch=('any')
license=('MIT')
depends=('python' 'python-mako' 'python-sqlalchemy' 'python-editor'
         'python-dateutil')
makedepends=('python-setuptools' 'python-mako' 'python-sqlalchemy' 'python-editor' 'python-dateutil')
checkdepends=('python-pytest')
source=($pkgname-$pkgver.tar.gz::https://github.com/sqlalchemy/alembic/archive/refs/tags/rel_${pkgver//./_}.tar.gz)
sha512sums=('888b6c11d32fc84dc1c18ed80bdf5edd053b6fafe365e2a1d99e726207216005d5d9a3f5368b1d80ed2ca56d3cacf7ef99b3e943c09fb398a74c17074e1ca63e')
b2sums=('339e5b5670b32caad134fd97a51530094a233fcc28ff90ab0d9c41047158d017ae6bea270a7216bbe954fc1c705cb19c5d1c7dd2415f3c739be8c4be46c3a8ba')

prepare() {
  cd alembic-rel_${pkgver//./_}
  # do not treat warnings as errors
  sed 's|-p no:warnings||g' -i setup.cfg
}

build() {
  cd alembic-rel_${pkgver//./_}
  python setup.py build
}

check() {
  cd alembic-rel_${pkgver//./_}
  py.test
}

package() {
  cd alembic-rel_${pkgver//./_}
  python setup.py install --root="${pkgdir}" --prefix=/usr -O1 --skip-build
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.rst CHANGES -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
